#include "customeidt.h"
#include <QDebug>
CustomEidt::CustomEidt(QWidget *p):QLineEdit(p)
{
    setStyleSheet(" QLineEdit {\
                  border: 2px solid gray;\
            border-radius: 10px;\
padding: 0 8px;\
background: yellow;\
    selection-background-color: darkgray;\
}");
}

CustomEidt::CustomEidt(const QIcon &ic, QWidget *p) : QLineEdit(p)
{
    setStyleSheet(" QLineEdit {\
                  border: 2px solid gray;\
            border-radius: 10px;\
padding: 0 8px;\
background: yellow;\
    selection-background-color: darkgray;\
}");

act = addAction(ic,QLineEdit::TrailingPosition);
}

void CustomEidt::setActionIcon(const QIcon &ic)
{
    act->setIcon(ic);
}

void CustomEidt::keyPressEvent(QKeyEvent *e)
{
    //accept  ignore
    if(e->key() == Qt::Key_0)
    {
        qDebug()<<"keyPressEvent";
    }
//        return false;
        e->ignore();
//    e->accept();
}
#if 1
bool CustomEidt::event(QEvent *e)
{
    if(e->type() == QEvent::KeyPress)
    {
        if(static_cast<QKeyEvent*>(e)->key() == Qt::Key_0)
        {
            qDebug()<<"event";
        }
//        return false;
    }

    return QLineEdit::event(e);
}
#endif



